<?php


$username = $_POST['username'];
$password = $_POST['password'];

$_SESSION['username'] = $_POST['username'];

include 'DBLibrary/config.php';
include 'DBLibrary/openDB.php';

mysql_select_db("rotaract");
$query = "SELECT * FROM officer WHERE username='$username' and password='$password'";
$result = mysql_query($query);
$row = mysql_num_rows($result);
if ($row == 1) {
    $row = mysql_fetch_array($result);
    $_SESSION['userName'] = $row['username'];
    $_SESSION['firstName'] = $row['firstName'];
    $_SESSION['isAdmin'] = $row['isAdmin'];
    echo $_SESSION['userName'];
    echo $_SESSION['firstName'];
    echo $_SESSION['isAdmin'];

    $confirm = header('Location: http://localhost/Rotaract/RAC-Officerpage.php');
} 
//else{
//    
//    $confirm = header('Location: http://localhost/Rotaract/index.php');
//}


mysql_close($conn);
?>
